package com.UI
{
	import com.*;
	import com.Engine.*;
	import com.Packet.*;
	
	import flash.display.*;
	import flash.events.*;
	import flash.external.*;
	import flash.filters.*;
	import flash.geom.*;
	import flash.system.*;
	import flash.text.*;
	import flash.ui.*;
	import flash.utils.*;
	
	import org.aswing.*;
	import org.aswing.VectorListModel;
	import org.aswing.border.*;
	import org.aswing.border.EmptyBorder;
	import org.aswing.colorchooser.*;
	import org.aswing.event.*;
	import org.aswing.ext.*;
	import org.aswing.geom.*;
	import org.aswing.table.*;
	public class FrameBattleEndLose extends JFrame
	{
		//members define
		private var btn_battle_end_close:JButton;
		private var labelInfo:MultilineLabel;
		
		//private var btn_close:JButton;
		public function FrameBattleEndLose()
		{
			super();
			setDragable(false);
			setClosable(false);
			setResizable(false);
			setTitleBar(null);
			setBorder(new EmptyBorder());
			setBackgroundDecorator(new SolidBackground(new ASColor(0,0)));
			
			//component creation
			setSize(new IntDimension(280, 240));
			setPreferredSize(new IntDimension(280, 240));
			var layout0:EmptyLayout = new EmptyLayout();
			getContentPane().setLayout(layout0);
			
			btn_battle_end_close = new JButton();
			btn_battle_end_close.setLocation(new IntPoint(115, 203));
			btn_battle_end_close.setSize(new IntDimension(49, 25));
			btn_battle_end_close.setPreferredSize(new IntDimension(49, 25));
			btn_battle_end_close.setText("label");
			
			labelInfo = new MultilineLabel();
			labelInfo.setLocation(new IntPoint(27, 81));
			labelInfo.setSize(new IntDimension(224, 99));
			labelInfo.setPreferredSize(new IntDimension(224, 99));
			
			//component layoution
			getContentPane().append(btn_battle_end_close);
			getContentPane().append(labelInfo);
			
			//------------------------------------------
			setImages();
		}
		public function setImages():void
		{
			setBackgroundDecorator(null);
			var img_background:DisplayObject = Client.getUIElement("img_battle_end_lose_bg") as DisplayObject
			setBackgroundDecorator(new AssetBackground(img_background));
			setSize(new IntDimension(img_background.width, img_background.height));
			pack();
			setPreferredSize(new IntDimension(img_background.width, img_background.height));
			setLocationXY((Engine.W - width) / 2,(Engine.H - height)/2);
			
			
			var filter:GlowFilter = new GlowFilter(0x000000, 1, 2, 2, 100);
			var font:ASFont = new ASFont("宋体", 12, false, false, false, false);
			
			btn_battle_end_close.wrapSimpleButton(Client.getUIElement("btn_battle_end_close") as SimpleButton);
			btn_battle_end_close.setText("");

			//btn_close.wrapSimpleButton(Client.getUIElement("btn_close") as SimpleButton);
			labelInfo.setEditable(false);
			labelInfo.setBackgroundDecorator(null);
			labelInfo.setFont(new ASFont("宋体", 14, false, false, false, false));
			labelInfo.setForeground(ASColor.GREEN);
			labelInfo.setWordWrap(true);
			labelInfo.filters = new Array(filter);
			
			labelInfo.setHtmlText("    提升等级,升级技能,升级装备,强化属性,携带宠物,提升宠物等都可以提升战斗力!<br>    努力努力,再接再厉!");
			
			btn_battle_end_close.addEventListener(MouseEvent.CLICK,function():void
			{
				FrameBattleEndLose.hide();
			});
			
		}
		public function update():void
		{
			
			//var img_background:DisplayObject = Client.getUIElement(result == 0 ? "img_battle_end_lose_bg" : "img_battle_end_win_bg") as DisplayObject;
			//setBackgroundDecorator(new AssetBackground(img_background));
			//txtResultInfo.setHtmlText(content);
		}
		public static var _frame:FrameBattleEndLose = null;
		//public static var _currentCharNpc:ObjectCharNPC = null;
		public static function show():void
		{
			if(_frame == null)
			{
				_frame = new FrameBattleEndLose();
				PanelMainHelp.getInstance().addChild(_frame);
			}
			_frame.show();
			PanelMainHelp.getInstance().bringToTop(_frame);
			_frame.update();
			
		}
		public static function hide():void
		{
			if(isShowing())_frame.hide();
			PanelMain.getInstance().leaveBattle();
		}
		public static function isShowing():Boolean
		{
			return(_frame != null&& _frame.isShowing());
		}
		public function onClose(e:Event):void 
		{
			hide();
		}
	}
}